$(function () {

    //请求热点图功能
    $.ajax({
        method: 'GET',
        url: 'http://localhost:8080/api/v1/index/hotpic',
        data: {
        },
        success: (res) => {
            console.log(res);

            let htmlStr = template("hotpic", { data: res.data })
            $(".focus_list").html(htmlStr);
        }
    })


    //一周文章排名
    $.ajax({
        method: 'GET',
        url: 'http://localhost:8080/api/v1/index/rank',
        data: {},
        success: (res) => {
            console.log(res);
            let htmlStr = template("ranklist", { data: res.data });
            $(".hotrank_list").html(htmlStr);
        }
    })


    //最新资讯
    $.ajax({
        url: 'http://localhost:8080/api/v1/index/latest',
        type: 'get',
        dataType: 'json',
        success: function (backData) {
            console.log(backData);
            $('.common_news').html(template("common_news_list", { data: backData.data }));

        }
    });

    //最新评论

    $.ajax({
        method: '',
        url: 'http://localhost:8080/api/v1/index/latest_comment',
        data: {},
        success: (res) => {
            console.log(res);
            $(".comment_list").html(template("comment", { data: res.data }))
        }
    })

    //焦点关注
    $.ajax({
        method: 'GET',
        url: 'http://localhost:8080/api/v1/index/attention',
        data: {},
        success: (res) => {
            console.log(res);
            $(".guanzhu_list").html(template("guanzhu", { data: res.data }))
        }
    })
})